﻿using System;
using wojilu.Apps.Qycms.Domain;
using wojilu.Apps.Qycms.Interface;

namespace wojilu.Apps.Qycms.Service
{
    public class PowerGroupService : IPowerGroupService
    {
        public Boolean powercheck(String type, String powerName, PowerGroup model)
        {
            if (model != null)
            {
                if (model.powerlist == "all")
                {
                    return true;
                }
                if (model.powerlist.StrIsNullOrEmpty())
                {
                    return false;
                }
                var powerlist = "|" + model.powerlist + "|";
                if (powerlist.Contains("|" + type + "|"))
                {
                    if (powerlist.Contains("|" + powerName + "|"))
                    {
                        return true;
                    }
                }
                return false;
            }
            return false;
        }

    }
}
